//
//  DeferredLightingAppDelegate.m
//  DeferredLighting
//
//  Created by Holmes Futrell on 2/8/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "DeferredLightingAppDelegate.h"
#import "DeferredLightingView.h"

@implementation DeferredLightingAppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
	// Insert code here to initialize your application 
	
	NSOpenGLPixelFormatAttribute attributes[] = {
			NSOpenGLPFADoubleBuffer,
			NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)0,
			NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)24,
			NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)0, // no stencil
			NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)0, // no depth buffer
			(NSOpenGLPixelFormatAttribute)0
	};
		
	NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes: attributes];
	
	if (!pixelFormat) {
		NSLog(@"Pixel format initialization failed");
		[[NSApplication sharedApplication] terminate: self];
	}
	
	NSOpenGLView *deferredLightingView = [[DeferredLightingView alloc] initWithFrame: NSMakeRect(0,0,32,32) pixelFormat: pixelFormat ];
	
	[window setContentView: deferredLightingView];
	[window makeFirstResponder: deferredLightingView];
	
	[deferredLightingView release];
	
}

@end
